package com.cy.pj.goods.dao;

import com.cy.pj.goods.pojo.Goods;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
@Slf4j
@Repository
public class GoodsDaoImpl implements GoodsDao{

    @Autowired
    SqlSessionFactory ssf;

    @Autowired
    GoodsDao good;
    @Override
    public List<Goods> findGoods() {
        SqlSession session = ssf.openSession();
        List<Goods> goodsList = session.selectList("com.cy.pj.goods.dao.GoodsDao.findGoods", Goods.class);
        return goodsList;

    }

    @Override
    public int deleteById(Integer id) {
        return good.deleteById(id);

    }

    @Override
    public int deleteByHenDuoId(String id) {
        return good.deleteByHenDuoId(id);
    }


}
